package com.zxl.live.screen.call.ui.widget;

import android.content.Context;
import android.util.AttributeSet;

import com.zxl.live.tools.tools.DrawUtils;

/**
 * Created by Administrator on 2017/12/8.
 */

public class AutoRoundLayout extends RoundRelativeLayout {

    public AutoRoundLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(MeasureSpec.makeMeasureSpec(getCallWidth(), MeasureSpec.AT_MOST),  MeasureSpec.makeMeasureSpec(getCellHeight(), MeasureSpec.AT_MOST));
    }

    public static int getCallWidth() {
        return (int) (DrawUtils.getScreenWidth() / 2 - getSpace() * 1.5f);
    }

    public static int getCellHeight() {
        float scale = (float) getCallWidth() / 517f;
        return  (int) (920 * scale);
    }

    public static int getSpace() {
        return DrawUtils.dip2px(15);
    }

}
